<%-- 
    Document   : newsercharge
    Created on : Nov 25, 2011, 10:35:41 AM
    Author     : Venus
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*, Beans.ThoiDiem, Beans.KhuVuc, Beans.ThamSoHT,Models.ThamSoHT_Model, Models.Ban_Model,  Models.ThoiDiem_Model"%>
<script type="text/javascript">
    function keypress(e){
        //Hàm dùng để ngăn người dùng nhập các ký tự khác ký tự số vào TextBox
        var keypressed = null;
        if (window.event)
        {
            keypressed = window.event.keyCode; //IE
        }
        else
        {
            keypressed = e.which; //NON-IE, Standard
        }
        if (keypressed < 48 || keypressed > 57 )
        { //CharCode của 0 là 48 (Theo bảng mã ASCII)
            //CharCode của 9 là 57 (Theo bảng mã ASCII)
            if (keypressed == 8 || keypressed == 127  )
            {//Phím Delete và Phím Back
                return;
            }
            return false;
        }
    }
</script>
<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'serchargeexist', 'msgsercharge', 'rightmsg', 'save', 'areaname', 'all', 'timename', 'checksubmitmsg', 'createsercharge', 'servicecharge', 'serchargelist', 'notice', 'order' ";
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.
            String all = mdsts[0].getTenTS();
            String areaname = mdsts[1].getTenTS();
            String checksubmitmsg = mdsts[2].getTenTS();
            String createsercharge = mdsts[3].getTenTS();
            String msgsercharge = mdsts[4].getTenTS();
            String notice = mdsts[5].getTenTS();
            String order = mdsts[6].getTenTS();
            String rightmsg = mdsts[7].getTenTS();
            String save = mdsts[8].getTenTS();
            String serchargeexist = mdsts[9].getTenTS();
            String serchargelist = mdsts[10].getTenTS();
            String servicecharge = mdsts[11].getTenTS();
            String timename = mdsts[12].getTenTS();
            

            String msgright = notice + "/" + rightmsg;
            String msgchecksubmit = notice + "/" + checksubmitmsg;
            String serchargemsg = notice + "/" + msgsercharge;
            String serchargeexistmsg = notice + "/" + serchargeexist;

            Vector vDSPPV = (Vector) request.getAttribute("DSPPV");
            Vector vDSKV = (Vector) request.getAttribute("DSKV");
            Vector vDSTD = (Vector) request.getAttribute("DSTD");
            int numpage = 0;// khởi tạo số trang = 0
            int vsize = vDSPPV.size();
            if (vsize % 6 == 0) // mỗi trang có 6 dòng
            {
                numpage = vsize / 6;
            } else {
                numpage = vsize / 6 + 1;
            }
            String xx = (String) request.getAttribute("item"); // trang hiện tại đang xem
            int item = Integer.parseInt(xx);

%>
<h1><img style=" margin-right: 13px; opacity: 0.8; margin-top: 6px;" alt="" src="../images/money.png"><%=servicecharge %></h1>
<div class="cb"></div>
<div id="ShowTaoKH" class="bloc" style="width: 87%; margin-top: 8px; " >
    <div class="title">
        <%=createsercharge%>
        
    </div>
    <div class="content">
        <form name="createsercharge" action="">            
                <div style=" margin: 0 30px 8px 40px; float: left;">
                    <div style=" width: 90px; float: left; "><%=areaname%></div>
                    <select style=" width: 200px; padding-bottom: 4px; padding-top: 4px; margin-bottom: 10px; height: 27px;" class="text" id="select" name="makv" >
                        <%
                            for (int i = 0; i < vDSKV.size(); i++) {
                                Beans.KhuVuc kv = (Beans.KhuVuc) vDSKV.elementAt(i);
                        %>
                        <option value="<%=kv.getMaKV() %>" ><%= kv.getTenKV() %></option>
                        <%  }
                        %>
                    </select>
                </div>

                <div style=" margin: 0 10px 8px;">
                    <div style=" width: 120px; float: left; margin-left: 40px;"><%=timename%></div>
                    <select style=" width: 200px; padding-bottom: 4px; padding-top: 4px; margin-bottom: 10px; height: 27px;" class="text" id="select" name="matd" >
                        <%
                            for (int i = 0; i < vDSTD.size(); i++) {
                                Beans.ThoiDiem td = (Beans.ThoiDiem) vDSTD.elementAt(i);
                        %>
                        <option value="<%=td.getMaTD() %>" ><%= td.getTenTD() %></option>
                        <%  }
                        %>
                    </select>
                </div>
                <div style=" margin: 0 10px 8px; float: right; ">
                    <div style=" width: 120px; float: left; margin-top: 10px;"><%=servicecharge%></div>
                    <div style=" margin-right: 210px; float: left; margin-top: 10px;">
                        <input style=" width: 50px; margin-right: 10px;" type="text" class="text" name="servicecharge" onkeypress="return keypress(event)" maxlength="2">%
                    </div>
                </div>
                    <input style=" margin-left: 260px;margin-bottom: 10px; margin-top: 5px;" maxlength="2" class="button" type="button"  value="<%=save%>" lang="<%=msgright%>" alt="<%=msgchecksubmit%>" id="<%=serchargeexistmsg%>" onclick="CreateSerCharge(this.lang, this.alt, this.id)">
        </form>
    </div>
</div>
<div id="DSPPV" class="bloc" style=" margin-top: 15px; width: 87%;">
    <div class="title">
        <%=serchargelist%>        
    </div>
    <div class="content">
        <form name="dsppv" action="">
            <table class="mytable" border="0" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th style="width: 15%;"><%=order%></th>
                        <th style=" width: 30%;">
                            <a href="#" id="titledskv1" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortTenKVPPV(this.className, this.name, this.lang)">
                                <div style="float:left"><%=areaname%></div>
                                <div style=" margin-right: 120px;" id="sortkv1" class="down1"></div>
                            </a>
                        </th>
                        <th style=" width: 30%;">
                            <a href="#" id="titledskv2" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortTenTDPPV(this.className, this.name, this.lang)">
                                <div style="float:left"><%=timename%></div>
                                <div style=" margin-right: 120px;" id="sortkv2" class="down1"></div>
                            </a>
                        </th>
                        <th>
                            <a href="#" id="titledskv3" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortPPV(this.className, this.name, this.lang)">
                                <div style="float:left"><%=servicecharge%></div>
                                <div style=" margin-right: 90px;" id="sortkv3" class="down1"></div>
                            </a>
                        </th>
                    </tr>
                    <tr id="searchPPV" >
                        <th><img onclick="SearchSerCharge( this.alt, this.lang)" lang="<%=msgright%>" style=" margin-top: 2px; margin-left: 3px; margin-bottom: -7px; cursor: pointer;" alt="1" src="../images/search1.png"></th>
                        <th>
                            <select style="width: 130px; height: 25px; padding-bottom: 2px; padding-top: 2px;" lang="<%=msgright%>" id="1"  class="tenkv text" onchange="SearchSerCharge( this.id, this.lang)">
                                <option value="all"><%=all%></option>
                                <%
                                    for (int i = 0; i < vDSKV.size(); i++) {
                                        Beans.KhuVuc kv = (Beans.KhuVuc) vDSKV.elementAt(i);
                                %>
                                <option value="<%=kv.getMaKV() %>" ><%= kv.getTenKV() %></option>
                                <%  }
                                %>
                            </select>
                        </th>                        
                        <th>
                            <select style="width: 130px; height: 25px; padding-bottom: 2px; padding-top: 2px;" lang="<%=msgright%>" id="1"  class="tentd text" onchange="SearchSerCharge( this.id, this.lang)">
                                <option value="all"><%=all%></option>
                                <%
                                    for (int i = 0; i < vDSTD.size(); i++) {
                                        Beans.ThoiDiem td = (Beans.ThoiDiem) vDSTD.elementAt(i);
                                %>
                                <option value="<%=td.getMaTD() %>" ><%= td.getTenTD() %></option>
                                <%  }%>
                            </select>
                        </th>
                        <th>
                            <input type="textbox" maxlength="2" style=" width: 50px; margin-right: 10px;"  class="ppv text"  onkeypress="return keypress(event)">%
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <%
                        for (int i = (item - 1) * 6; i < (item - 1) * 6 + 6 && i < vsize; i++) {
                            Beans.PhiPV ppv = (Beans.PhiPV) vDSPPV.elementAt(i);
                    %>
                    <tr>
                        <td class="STT"><%= i + 1%></td>
                        <td><%=Ban_Model.LayTenKV(ppv.getMaKV(), langid) %></td>
                        <td><%=ThoiDiem_Model.LayTenTD(ppv.getMaTD(), langid)  %></td>
                        <td><input type="textbox" alt="<%=ppv.getMaKV()%>" id="<%=ppv.getMaTD()%>" name="<%=msgright%>" lang="<%=serchargemsg%>" onchange="UpdatePPV(this.value, this.alt, this.id, this.name, this.lang)" class="text" style=" width: 50px; margin-right: 10px; float: left;" value="<%=ppv.getPhiPV() %>" maxlength="2" onkeypress="return keypress(event)">%<img style=" margin-left: 20px; width: 17px; margin-top: 2px; cursor: pointer;" alt="" src="../images/edit.png"></td>
                    </tr>
                    <%  } %>                    
                </tbody>
            </table>
            <div class="pagination">
                <%
                    int trang = 1;
                    if (item > 1) {
                        trang = item - 1;
                    }
                %>
                <%
                    if (vsize > 6) {%>
                        <a href="#" class="prev" lang="<%=msgright%>"  name="<%= trang%>" onclick="ServiceCharge(this.name, this.lang)">«</a>
                <%  for (int c = 1; c <= numpage; c++) {
                        if (c != item) {
                %>          <a href="#" lang="<%=msgright%>" name="<%= c%>" onclick="ServiceCharge(this.name, this.lang)" ><%= c%></a>
                <%      } else {%><a class="current"> <%= c%></a> <% }
                    }
                %>
                <%
                    if (item + 1 <= numpage) {
                        trang = item + 1;
                    } else {
                        trang = item;
                    }
                %>  <a href="#" class="next" lang="<%=msgright%>" name="<%= trang%>" onclick="ServiceCharge(this.name, this.lang)">»</a>
                <%  }
                %>
            </div>
        </form>
    </div>
</div>

